package com.tomdd.log.service.impl;

import com.tomdd.log.service.TestService;
import com.tomdd.log.utils.TestThreadLocalUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author zx
 * @date 2024年11月26日 15:34
 */
@Service
@Slf4j
public class TestServiceImpl implements TestService {

    @Override
    @Async("CustomerExecutor")
    public void insertLog() throws InterruptedException {
        Thread.sleep(2000);
        log.info("正在执行插入日志操作");
        String message = TestThreadLocalUtils.get();
        log.info("从ThreadLocal中获取信息:{}",message);
    }
}
